@custom-variant dark (&:is(.dark *));

:root {
  --font-size: 14px;
  --background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --foreground: oklch(0.145 0 0);
  --card: rgba(255, 255, 255, 0.8);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.96 0.0058 264.53);
  --secondary-foreground: #1e293b;
  --muted: rgba(248, 250, 252, 0.6);
  --muted-foreground: #64748b;
  --accent: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  --accent-foreground: #0f172a;
  --destructive: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --destructive-foreground: #ffffff;
  --border: rgba(148, 163, 184, 0.3);
  --input: rgba(255, 255, 255, 0.9);
  --input-background: rgba(255, 255, 255, 0.95);
  --switch-background: #cbd5e1;
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --ring: oklch(0.708 0 0);
  --chart-1: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  --chart-2: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --chart-3: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --chart-4: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --chart-5: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  --radius: 0.75rem;
  --sidebar: rgba(255, 255, 255, 0.9);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: rgba(241, 245, 249, 0.8);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: rgba(148, 163, 184, 0.15);
  --sidebar-ring: oklch(0.708 0 0);
  
  /* 优化后的轻量投影变量 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 4px 8px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 8px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-2xl: 0 12px 25px -5px rgba(0, 0, 0, 0.12);
  
  /* 轻量悬浮投影 */
  --shadow-hover: 0 4px 12px -2px rgba(59, 130, 246, 0.08), 0 2px 6px -1px rgba(139, 92, 246, 0.05);
  --shadow-hover-card: 0 6px 16px -4px rgba(0, 0, 0, 0.06), 0 2px 8px -1px rgba(59, 130, 246, 0.04);
}

.dark {
  --background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --foreground: oklch(0.985 0 0);
  --card: rgba(30, 41, 59, 0.8);
  --card-foreground: oklch(0.985 0 0);
  --popover: rgba(15, 23, 42, 0.95);
  --popover-foreground: oklch(0.985 0 0);
  --primary: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: rgba(51, 65, 85, 0.8);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: rgba(30, 41, 59, 0.6);
  --muted-foreground: #94a3b8;
  --accent: rgba(51, 65, 85, 0.6);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  --destructive-foreground: oklch(0.985 0 0);
  --border: rgba(71, 85, 105, 0.4);
  --input: rgba(51, 65, 85, 0.8);
  --ring: oklch(0.439 0 0);
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --chart-1: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
  --chart-2: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --chart-3: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --chart-4: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  --chart-5: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
  --sidebar: rgba(15, 23, 42, 0.95);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: rgba(30, 41, 59, 0.8);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: rgba(71, 85, 105, 0.3);
  --sidebar-ring: oklch(0.439 0 0);
  
  /* 暗主题轻量投影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.12), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 8px -2px rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.08);
  --shadow-2xl: 0 12px 25px -5px rgba(0, 0, 0, 0.2);
  
  /* 暗主题轻量悬浮投影 */
  --shadow-hover: 0 4px 12px -2px rgba(96, 165, 250, 0.12), 0 2px 6px -1px rgba(167, 139, 250, 0.08);
  --shadow-hover-card: 0 6px 16px -4px rgba(0, 0, 0, 0.15), 0 2px 8px -1px rgba(96, 165, 250, 0.06);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-input-background: var(--input-background);
  --color-switch-background: var(--switch-background);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  
  /* 投影工具类 */
  --shadow-sm: var(--shadow-sm);
  --shadow: var(--shadow);
  --shadow-md: var(--shadow-md);
  --shadow-lg: var(--shadow-lg);
  --shadow-xl: var(--shadow-xl);
  --shadow-2xl: var(--shadow-2xl);
  --shadow-hover: var(--shadow-hover);
  --shadow-hover-card: var(--shadow-hover-card);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  html {
    /* 保留滚动条空间以防止内容跳动 */
    scrollbar-gutter: stable;
    /* 确保总是显示垂直滚动条空间 */
    overflow-y: scroll;
  }

  body {
    @apply text-foreground;
    background: var(--background);
    /* 防止水平滚动 */
    overflow-x: hidden;
  }
  
  /* 全局卡片样式增强 - 使用更轻的投影 */
  .card-enhanced {
    background: var(--card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .card-enhanced:hover {
    box-shadow: var(--shadow-hover-card);
    transform: translateY(-1px);
  }
  
  /* 按钮悬浮效果 - 优化投影和变换 */
  .btn-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .btn-enhanced:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-0.5px);
  }
  
  .btn-enhanced:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.5s;
  }
  
  .btn-enhanced:hover:before {
    left: 100%;
  }
}

/**
 * Base typography. This is not applied to elements which have an ancestor with a Tailwind text class.
 */
@layer base {
  :where(:not(:has([class*=" text-"]), :not(:has([class^="text-"])))) {
    h1 {
      font-size: var(--text-2xl);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h2 {
      font-size: var(--text-xl);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h3 {
      font-size: var(--text-lg);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h4 {
      font-size: var(--text-base);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    p {
      font-size: var(--text-base);
      font-weight: var(--font-weight-normal);
      line-height: 1.5;
    }

    label {
      font-size: var(--text-base);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    button {
      font-size: var(--text-base);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    input {
      font-size: var(--text-base);
      font-weight: var(--font-weight-normal);
      line-height: 1.5;
    }
  }
}

/* 自定义工具类 */
@layer utilities {
  .shadow-glow {
    box-shadow: var(--shadow-hover);
  }
  
  .shadow-card {
    box-shadow: var(--shadow-hover-card);
  }
  
  .bg-gradient-primary {
    background: var(--primary);
  }
  
  .bg-gradient-secondary {
    background: var(--secondary);
  }
  
  .bg-gradient-accent {
    background: var(--accent);
  }
  
  .text-gradient {
    background: var(--primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  /* 输入框选中文字样式优化 */
  .input-enhanced {
    color: #0f172a;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
  }
  
  .input-enhanced:focus {
    border-color: #4f46e5;
    outline: 2px solid rgba(79, 70, 229, 0.2);
    outline-offset: -2px;
  }
  
  .input-enhanced::selection {
    background-color: rgba(79, 70, 229, 0.2);
    color: #0f172a;
  }
  
  .input-enhanced::-moz-selection {
    background-color: rgba(79, 70, 229, 0.2);
    color: #0f172a;
  }
  
  /* 针对工作记忆测试输入框的专门优化 */
  input.working-memory-input {
    color: #1e293b !important;
    background-color: #ffffff !important;
    border: 2px solid #e2e8f0 !important;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace !important;
    font-size: 1.25rem !important;
    text-align: center !important;
    padding: 0.75rem !important;
  }
  
  input.working-memory-input::placeholder {
    color: #94a3b8 !important;
    opacity: 0.8 !important;
  }
  
  input.working-memory-input:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    outline: none !important;
    ring: none !important;
  }
  
  input.working-memory-input::selection {
    background-color: #a5b4fc !important;
    color: #1e293b !important;
  }
  
  input.working-memory-input::-moz-selection {
    background-color: #a5b4fc !important;
    color: #1e293b !important;
  }
  
  /* 额外确保在暗主题下也能正确显示 */
  .dark input.working-memory-input {
    color: #1e293b !important;
    background-color: #ffffff !important;
  }
  
  .dark input.working-memory-input::selection {
    background-color: #a5b4fc !important;
    color: #1e293b !important;
  }
  
  .dark input.working-memory-input::-moz-selection {
    background-color: #a5b4fc !important;
    color: #1e293b !important;
  }
  
  /* 优化情绪识别测试的置信度滑块样式 */
  .emotion-confidence-slider [data-orientation="horizontal"] {
    height: 0.75rem !important;
    background: linear-gradient(90deg, #fdf2f8 0%, #fce7f3 50%, #fbcfe8 100%) !important;
    border-radius: 9999px !important;
  }
  
  .emotion-confidence-slider [role="slider"] {
    width: 1.25rem !important;
    height: 1.25rem !important;
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important;
    border: 2px solid white !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(236, 72, 153, 0.2) !important;
    transition: all 0.2s ease !important;
  }
  
  .emotion-confidence-slider [role="slider"]:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(236, 72, 153, 0.3) !important;
  }
  
  .emotion-confidence-slider [role="slider"]:focus {
    outline: 2px solid rgba(236, 72, 153, 0.3) !important;
    outline-offset: 2px !important;
  }
  
  /* 进度条填充部分 */
  .emotion-confidence-slider [data-orientation="horizontal"] > span {
    background: linear-gradient(90deg, #ec4899 0%, #db2777 100%) !important;
    border-radius: 9999px !important;
  }
}

html {
  font-size: var(--font-size);
}